04. Exercise: Create a Layout

Quiz: Create Layout

INSTRUCTOR NOTE:

At 1:00, the layout_width of EditText is set to match_parent. This value should be set to wrap_content to match the TODO task in the exercise.

Now it's your turn. Create our "Github Query" Layout, following all the TODOs in the exercise, and attach it to your Java code. Have fun!

Exercise Code

Exercise: T02.01-Exercise-CreateLayout

Create Layout

SOLUTION:
  • Convert the ConstraintLayout to a LinearLayout
  • Add the EditText for the query
  • Add a TextView to display the URL
  • Add a scrolling TextView (TextView in a ScrollView) to display the query result
  • Create and populate the MainActivity member variables for the Search Box EditText, the URLDisplay TextView, and the SearchResults TextView
  • Remove the unneeded reference to the ConstraintLayout library